
// 定义首页需要的接口函数
import qingqiugongju from '@/utils/qingqiugongju'

/**
 * 获取首页头部分类数据
 */
export const fenleiqinqiu = () => {
  const res = qingqiugongju('/home/category/head', 'get')
  return res
}
// 首页主体-左侧分类-处理品牌请求
export const pinpaiqinqiu = (limit = 6) => {
  const res = qingqiugongju('/home/brand', 'get', { limit })
  return res
}
// 首页主体-轮播图-图片的请求
export const lunbotuqinqiu = () => {
  return qingqiugongju('/home/banner', 'get')
}
// 首页主体-新鲜好物-展示请求
export const chaKanQuanBuqinqiu = () => {
  return qingqiugongju('home/new', 'get')
}
// 首页主体-人气推荐-展示请求
export const renqituijianqinqiu = () => {
  return qingqiugongju('home/hot', 'get')
}
// 首页主体-商品区块-区块详情请求
export const qukuaiqinqiu = () => {
  return qingqiugongju('home/goods', 'get')
}
// 首页主体-最新专题-数据请求
export const zuixinzuangtiqinqiu = () => {
  return qingqiugongju('home/special', 'get')
}

/** category  顶级类目  商品展示     开始
 * 获取单个顶级分类信息
 * @param {String} id - 顶级分类ID
 */

// 顶级类目-单个商品详情-展示请求

export const zhanshiqinqiu = (id) => {
  return qingqiugongju('/category', 'get', { id })
}

/**
 * 获取二级分类筛选条件数据
 * @param {String} id - 二级分类ID
 */
export const erjifenleiqinqiu = (id) => {
  return qingqiugongju('/category/sub/filter', 'get', { id })
}

/**
 * 获取分类下的商品（带筛选条件）
 * @param {Object} params - 可参考接口文档
 */
export const fenleishaixuanqinqiu = (params) => {
  return qingqiugongju('/category/goods/temporary', 'post', params)
}

// 顶部导航分类
export const fenlei = [
  '居家',
  '美食',
  '服饰',
  '母婴',
  '个护',
  '严选',
  '数码',
  '运动',
  '杂货'
]
